<script>

if (typeof XMLHttpRequest == 'undefined')
XMLHttpRequest = function () {
	return new ActiveXObject('MSXML2.XMLHTTP.3.0')
}

function getBytes(url) {
	var req = new XMLHttpRequest()
	req.open('GET', url, false)
	req.send(null)
	if ('responseBody' in req) {
		return new VBArray(bytes2array(req.responseBody)).toArray()
	} else {
		return req.responseText.split('')
	}
}

window.onload = function () {
	try{
		var s = getBytes('test-utf16')
		alert(s.length)
	}catch(e){
		alert(e.name + ': ' + e.message)
	}
}
</script>

<script language="vbscript">
Function bytes2array(bytes)
	Dim a, n, i
	n = LenB(bytes) - 1
	ReDim a(n)
	For i = 1 To n
		a(i - 1) = AscB(MidB(bytes, i, 1))
	Next
	bytes2array = a
End Function
</script>

